<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class SemesterRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
      //  dd($this->end);
        return [
            'begin' => 'date|before:end',
            'end' => 'date|after:begin'
        ];
    }
    public function messages()
    {
        return [
            'begin.before' => '开始日期应在结束日期之前',
            'end.after' => '结束日期应在开始日期之后',
            'end.date'=>'时间格式不正确',
            'begin.date'=>'时间格式不正确',
        ];
    }
}
